package com.ewzj.bigdata.mvp.ui.adapter

import android.app.Activity
import android.view.View

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.ewzj.bigdata.R
import com.ewzj.bigdata.app.config.AppKey
import com.ewzj.bigdata.mvp.model.rspbean.CityBean
import com.jess.arms.base.BaseApplication
import com.jess.arms.utils.DataHelper

/**
 * author:zhangjing
 * 作用:
 * return:
 */

class HotcityAdapter(data: List<CityBean.ListEntity>) : BaseQuickAdapter<CityBean.ListEntity, BaseViewHolder>(R.layout.item_hotcity, data) {

    override fun convert(baseViewHolder: BaseViewHolder, listEntity: CityBean.ListEntity) {
        baseViewHolder.setText(R.id.tv_cityname, listEntity.city)
        baseViewHolder.getConvertView().setOnClickListener { run{
            var gson=(mContext.applicationContext as BaseApplication).appComponent.gson()
            DataHelper.SetStringSF(mContext, AppKey.LOCATION_CITY,gson.toJson(listEntity))
            (mContext as Activity).finish()
        }}
    }
}
